UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZhNV4aosIWJTJn88eYD/9rQSacZHAO0PctnFP6lDe20='
WHERE
key_id = 'c525f18c38478a27ab191d365e99006fae45c31254456e674a18e8311533fe31'
AND (
token = 'ZhNV4aosIWJTJn88eYD/9rQSacZHAO0PctnFP6lDe20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)