UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TptDUbKw+i23C4R1nGYT/Ks9RN39imkTderNiADzacM=' 
WHERE 
  key_id = '320bc091ff7e44f2deaeb4dbde8ad08b6f2299404dca73b2246bf8b9e73c8cc1' 
  AND (
    token = 'TptDUbKw+i23C4R1nGYT/Ks9RN39imkTderNiADzacM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042