UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2NDvKB2OkN2pN2b4Vb3K8oo8WpotWyuw4dX30Q6mPrk='
WHERE
key_id = 'c726f3000592014027ce08b07dac6453104d1d8b9b2522d76e90b56fd38ea75b'
AND (
token = '2NDvKB2OkN2pN2b4Vb3K8oo8WpotWyuw4dX30Q6mPrk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)