UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k+tijyBUIRnK2PgHrBjs1v0wUKRFek1GBeTziZZxdoA=' 
WHERE 
  key_id = '27340d038f6f4d95cf03719fa9052c83c5b5c935833a5457fb9e17867fe19417' 
  AND (
    token = 'k+tijyBUIRnK2PgHrBjs1v0wUKRFek1GBeTziZZxdoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039