UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z6sW0o5dvsMEz9meWWLiGYtZH5BOVGN9vI8sthLiWIg='
WHERE
key_id = 'f9ca6d134219b327c73f0a0ed8f30b7f4ac7b8947a84f87cfe583f4da21f548f'
AND (
token = 'Z6sW0o5dvsMEz9meWWLiGYtZH5BOVGN9vI8sthLiWIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)