UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NpqR79h4a9MepMfdCAdGjoUf6WsdUXC8lrYhH+s3jFw='
WHERE
key_id = 'de00895c0b5b0791b382dd54b5087da66d050f4ce8caaf1f2652fe8ff99d16f1'
AND (
token = 'NpqR79h4a9MepMfdCAdGjoUf6WsdUXC8lrYhH+s3jFw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)