UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LSX0ZvnkKHURTtQVI/eODzqudlHlROvR54qY/nHZdE8=' 
WHERE 
  key_id = '1b7465972930db683e2d6727641b07f0918bb1985c2118b11277ef45f28c5166' 
  AND (
    token = 'LSX0ZvnkKHURTtQVI/eODzqudlHlROvR54qY/nHZdE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038