UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2UgKcG0ac2dJCt6kEFOEqXLparwQQmfAFexoQODqgKc=' 
WHERE 
  key_id = '297f12f28e9016536bdda0ae2f51c8e70f1d2724a77066c17abf93c37c8ae45d' 
  AND (
    token = '2UgKcG0ac2dJCt6kEFOEqXLparwQQmfAFexoQODqgKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043