UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9cR2vWPZYE4ecNCUYfaniapi1NkHUENdimWtjoNQO20='
WHERE
key_id = '5f889fdbe135b5b35db5f9cc4c6016fd30da5253d1bc74c779bb827846880510'
AND (
token = '9cR2vWPZYE4ecNCUYfaniapi1NkHUENdimWtjoNQO20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)