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