UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1fpleZp51wXHVEGsN6zrmFQ/KT9ax0mxtBFd81C9Wc4='
WHERE
key_id = 'd9d02794daec2e0f4da0b743cee69860623758b21591efa9d31ec45b1391596f'
AND (
token = '1fpleZp51wXHVEGsN6zrmFQ/KT9ax0mxtBFd81C9Wc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)