UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3S3SmVmkdjU0gHEfEpjqelEJE3TWBudL5moZcdbHI2w=' 
WHERE 
  key_id = '264335d27a979d0229eb1163bbf6de63dac3e37d5a8e555a2b7f77d1359f4e9b' 
  AND (
    token = '3S3SmVmkdjU0gHEfEpjqelEJE3TWBudL5moZcdbHI2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026