UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7MgppMGLEv/XQlina/gwvn/CH1857zGGdGakvHpG/k='
WHERE
key_id = '961723cb88d9589ad3b50660d88a9a1833b6c33af830b6c608f896ec9b207fde'
AND (
token = 'n7MgppMGLEv/XQlina/gwvn/CH1857zGGdGakvHpG/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)