UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N5iC0hYLojCn5w0NyDaimKZTwFv+tGFueJuX6GYlXdY='
WHERE
key_id = '16bdf27e865ade383791c4b5830775066544a5ec47935b439ee177b7b5427a24'
AND (
token = 'N5iC0hYLojCn5w0NyDaimKZTwFv+tGFueJuX6GYlXdY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)