UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdvvtWylTLccBPFn4//XopilfWO1ixJyH1AO5FdxsJY=' 
WHERE 
  key_id = '8a736fcfb99098fe7ec0e83f4913dd617f6cc2356d1a60983fb2a4830d2106c7' 
  AND (
    token = 'cdvvtWylTLccBPFn4//XopilfWO1ixJyH1AO5FdxsJY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029