UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SNCoERKtKnpfEw/35eKteTR0Q+UCG6CA2uSkmg9PvD8='
WHERE
key_id = '682e8ea3d8095cfa522a0db0d601ded5a8b7985977e082ba45e4d16f389e4f5e'
AND (
token = 'SNCoERKtKnpfEw/35eKteTR0Q+UCG6CA2uSkmg9PvD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)