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