UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5KpFbq3pa3oOWvV5QMjxHyQD8WH8Y+tPihOJXTGM9yk='
WHERE
key_id = '3cd55914af9d3695ad97d7355e094b55ca1a7391ceff301df50b50fca3392c82'
AND (
token = '5KpFbq3pa3oOWvV5QMjxHyQD8WH8Y+tPihOJXTGM9yk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)