UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tbl/fcYTTycXjuAJGOAzU/emDFsmc2Tzxjsfef3rwmg='
WHERE
key_id = 'dd8868c69852c51894573fdfdd778e90f929c386900c326af482c45b6d10423b'
AND (
token = 'tbl/fcYTTycXjuAJGOAzU/emDFsmc2Tzxjsfef3rwmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)