UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yxXxGvbq2CwYhNKdjGfkFT0KPGkMbj43q4KZCW257Xo='
WHERE
key_id = 'c506b2e929e1a3ccacef58993de780e0faffe4523adb89ee20dd3b336ed5c828'
AND (
token = 'yxXxGvbq2CwYhNKdjGfkFT0KPGkMbj43q4KZCW257Xo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)