UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nylNRpbcU7+XyfPRMv4bZE8+pqbY5K37+wVcnx7ke0g=' 
WHERE 
  key_id = '5ef9bcc68f02a5017bf7358bf98512716190deb8585f63bf074236b05a247bda' 
  AND (
    token = 'nylNRpbcU7+XyfPRMv4bZE8+pqbY5K37+wVcnx7ke0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032