UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RMm+7ZgM3xZHmdSyLIswdvvW5iwqTwf8DMtiSkEBwj4='
WHERE
key_id = '0d690c35d4459df4c5cf08188672ab089000d9564b4e290e9384c5e430dc932a'
AND (
token = 'RMm+7ZgM3xZHmdSyLIswdvvW5iwqTwf8DMtiSkEBwj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)