UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PGdeDxvaCggDofc+7Mkme76DLby0vLPRR6GtFaKmQSg=' 
WHERE 
  key_id = '3cf49d55989d6fe584c963866908d091e3198ed6203d9c0a1f651a4b95e23617' 
  AND (
    token = 'PGdeDxvaCggDofc+7Mkme76DLby0vLPRR6GtFaKmQSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041