UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aDTrS2s7bEeam/I78ecxDEmTL2ZFqBv6sQCBghbe7Ok='
WHERE
key_id = 'e945f1a2271cb0ec2620f62de6f67d47bd6d81a878d3f780698fab65352a8345'
AND (
token = 'aDTrS2s7bEeam/I78ecxDEmTL2ZFqBv6sQCBghbe7Ok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)