UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kOWfCtfxRReqMUiUYcVCaNkyjz1YsLykaMEufdNZ0Z0=' 
WHERE 
  key_id = 'b256c22c67f6d71242c38a45f661ccec564219b4120c6d4d91e8ec2a9441adb7' 
  AND (
    token = 'kOWfCtfxRReqMUiUYcVCaNkyjz1YsLykaMEufdNZ0Z0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016