UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CFl43zvcNiWwPeWwswOW8ucWthSfl2tjiz3tXxOerqY=' 
WHERE 
  key_id = '78140db64016e50f9e50d2746a274091c06c41ef13090ea737fcac8883bb9ba6' 
  AND (
    token = 'CFl43zvcNiWwPeWwswOW8ucWthSfl2tjiz3tXxOerqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033