UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9mcmmdVy2aKeyzzQPayNMxfspRMqrAspsCc8PNXsk2k='
WHERE
key_id = 'ddc8bab785deff784191e2bd641f627a9ae368aa188c1b6e97c570d96715eb71'
AND (
token = '9mcmmdVy2aKeyzzQPayNMxfspRMqrAspsCc8PNXsk2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)