UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OYxvXd9f7SMcz/1j5PnARtfNTS3mABag37Jijy3PEhw=' 
WHERE 
  key_id = '74fb8c4672c49abbea89ad13057fcee5a33a8df2bf9d15407032e04f14561351' 
  AND (
    token = 'OYxvXd9f7SMcz/1j5PnARtfNTS3mABag37Jijy3PEhw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026