UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'crsMSBD9ELcE9hYVOVwxUrAA7W4MUTEGGzeZ+bf5nAU='
WHERE
key_id = '3ed1e8693ae8017fc3f93f9c1588468e5ac577f57e1eecdda750a43db8a5ef5d'
AND (
token = 'crsMSBD9ELcE9hYVOVwxUrAA7W4MUTEGGzeZ+bf5nAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)