UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tupoFSyAfD5kBFV2cDpzS2riryho4LS8YkrQLxDtoyo=' 
WHERE 
  key_id = 'fa8cc213a76247d9cd74fb75b83e6f7470d20a829b8c0773815481e202032052' 
  AND (
    token = 'tupoFSyAfD5kBFV2cDpzS2riryho4LS8YkrQLxDtoyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033