UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2vIBX7C3aeNWr9xY7xT7uPNRbeaq/LVkX920NZrELdQ=' 
WHERE 
  key_id = 'd64a4924f65b43514daa74952dec014ac113af21cfa0c497d1e3af01fc4c1122' 
  AND (
    token = '2vIBX7C3aeNWr9xY7xT7uPNRbeaq/LVkX920NZrELdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028