UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd8Fi/m+RUwmK2e5HhhyHNNDPMG7DuyyUgUc9NWz9NHM=' 
WHERE 
  key_id = '26af766e293ad74c8d3d4de433a05e6f0c8344356a791125f65c0ea59f098de2' 
  AND (
    token = 'd8Fi/m+RUwmK2e5HhhyHNNDPMG7DuyyUgUc9NWz9NHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025