UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XSghEedOTMPQiNfuwAjeXn6LtzhUD3f3+EJoamd7ZJ4='
WHERE
key_id = '8bbe063a88d5b6d32e899e4e477e9374995f4b23a2defded2882ba6b6eb90758'
AND (
token = 'XSghEedOTMPQiNfuwAjeXn6LtzhUD3f3+EJoamd7ZJ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)