UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rjLPkjOMwjLCugKP0XY7iV46iPMyj77no7QMOraD4qM=' 
WHERE 
  key_id = '17e765012a702519b7d48d7b8dc18b58c8f1c1974db862d7a1fec2ff48539d53' 
  AND (
    token = 'rjLPkjOMwjLCugKP0XY7iV46iPMyj77no7QMOraD4qM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033