UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tEJXD/VaL5DH/JyCx2DKMPZHgyNtPUnZ8UmR545+tqs='
WHERE
key_id = 'c12ca4b60082377a87484a218c17d17afd07d2dd0baca0b60f7ebe88346ee19d'
AND (
token = 'tEJXD/VaL5DH/JyCx2DKMPZHgyNtPUnZ8UmR545+tqs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)