UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NUh0ufytv8QZ8cfW9VmFs2WjVp7nICLPIAMDGZHJzuo='
WHERE
key_id = 'da3064c4430612adc78cc0fbd4d12fbbb29b6fafe6c72fc4321ba6a11dc23e5a'
AND (
token = 'NUh0ufytv8QZ8cfW9VmFs2WjVp7nICLPIAMDGZHJzuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)