UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YLP5YGZ9sOiLE78b7yres+4DUbhft+HACrRCGRPl9UE='
WHERE
key_id = '8cbdddf2a9515aca6f5b021c0c7053fe78a0a15ddb8fb1e69f5a48732f3cc87e'
AND (
token = 'YLP5YGZ9sOiLE78b7yres+4DUbhft+HACrRCGRPl9UE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)