UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xz65pNw5XaI2NuK4ajxzYOJoCYFU4zxjOqQWPpg89q0='
WHERE
key_id = '6cca1004b8d93a6cef6e322a7cf9397bbabbbc4f99b6ed13b7a5011ddc27fc92'
AND (
token = 'Xz65pNw5XaI2NuK4ajxzYOJoCYFU4zxjOqQWPpg89q0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)