UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4mAxV+7RhvUTBmnbj5QQ4Hq7xxyvB7S3WxyTiFAx4bc='
WHERE
key_id = '04c47412169d5451d2e346d3406816a902f428317f2a8452d25a9864a5fb8aa4'
AND (
token = '4mAxV+7RhvUTBmnbj5QQ4Hq7xxyvB7S3WxyTiFAx4bc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)