UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rdIisrnB+zF26Cqg7A79TK8cCIkmUB+oALLVxKqCZG4='
WHERE
key_id = 'a88c9e82eefbf6eebbee13a13f4ea72d08a7e566a812b774be901b7eb42a361e'
AND (
token = 'rdIisrnB+zF26Cqg7A79TK8cCIkmUB+oALLVxKqCZG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)