UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LbUcHTOur40n6ciY7TWm9mpje4wzsunTV+f3eKMD2Ic=' 
WHERE 
  key_id = '44c3916b77173005342f6a4d7d091925d019034827295c9120d9acc596ac2778' 
  AND (
    token = 'LbUcHTOur40n6ciY7TWm9mpje4wzsunTV+f3eKMD2Ic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058