UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhPMHma+3wOZodD93JIMyqOWI0MvsScYd0igfJNYsGQ=' 
WHERE 
  key_id = 'c866b5295bca9af90e20e7dda5b921d88e6e732002db71ba059193aa99bad416' 
  AND (
    token = 'hhPMHma+3wOZodD93JIMyqOWI0MvsScYd0igfJNYsGQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027