UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1I2GDsqcdlFrwcYxPhiO4Pclmgnr1cKCWnikvOdRduw='
WHERE
key_id = 'f998d257a03a787d8ecb0f2a8c790a69846dbd1a91858919434f8373728e3bff'
AND (
token = '1I2GDsqcdlFrwcYxPhiO4Pclmgnr1cKCWnikvOdRduw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)