UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ImBKPMCfqVWrSC2hn9IrVVpT0CVGYONRertjBfsLJX4='
WHERE
key_id = '66d0e82370791332edfd4fc9e03911e01ed669650e882f389280176492a93ec6'
AND (
token = 'ImBKPMCfqVWrSC2hn9IrVVpT0CVGYONRertjBfsLJX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)