UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tTPYp6vkURuG0f/0ewi6qCP6OidmBTWLtt0MqtorFKM=' 
WHERE 
  key_id = '8e2c8d7689a4cc9ba032990130114216a0083a3d1b3a0730f728a677aa06730e' 
  AND (
    token = 'tTPYp6vkURuG0f/0ewi6qCP6OidmBTWLtt0MqtorFKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034