UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AfHt+eG/VON6bLlV7Wk9SPCKdLCudeKwmGQ1CNh8pWc=' 
WHERE 
  key_id = '7c89b930a321e942a9380c21f96dd0aa224c4643c312b88ec554272626ab43db' 
  AND (
    token = 'AfHt+eG/VON6bLlV7Wk9SPCKdLCudeKwmGQ1CNh8pWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019