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