UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3TPD2flHx5UdYhPwFmQ1uArf/3J5wxtTkxA0T55fvos='
WHERE
key_id = 'a80c44540331a5daa0e8b299a366d795b3e91b95ab32febaeaa94db3b771f915'
AND (
token = '3TPD2flHx5UdYhPwFmQ1uArf/3J5wxtTkxA0T55fvos='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)