UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8dV4DCd7preSXUoTOKsAsaDafBDVEVfJrzWNFJUe1KM=' 
WHERE 
  key_id = 'ff7e33acbf82272a8a4714c118ee58d9ceff5616070b34c0857686684dfaacba' 
  AND (
    token = '8dV4DCd7preSXUoTOKsAsaDafBDVEVfJrzWNFJUe1KM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032