UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K7k9m/JY6a7ORzVzJyUXFBA9mMqGs7wVaSsxO2bdAco=' 
WHERE 
  key_id = '2713017cb8fbf7a10e1e87d2b58c91ef1139404583167659d1884616e686ad71' 
  AND (
    token = 'K7k9m/JY6a7ORzVzJyUXFBA9mMqGs7wVaSsxO2bdAco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034