UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8XJDmoUxvcBOt84mdP+iO8OICmwzI8ww34Bd9I+qmJA='
WHERE
key_id = '7f384e10003bf1f3cf480b725c874882babc7b8a1c89e44692ddbd2bb7fb4713'
AND (
token = '8XJDmoUxvcBOt84mdP+iO8OICmwzI8ww34Bd9I+qmJA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)