UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SHL9SUClI1VBgFOIK+Fm3tPWUc2Ivdt9T44eKHFAjnE='
WHERE
key_id = 'af541f6e3a4c7bd12910145a82a3ae04c96006769931fc39451d564ae0946eaf'
AND (
token = 'SHL9SUClI1VBgFOIK+Fm3tPWUc2Ivdt9T44eKHFAjnE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)