UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fL9m5oxMGoMHx7D5DsGBfsETLL9ElcVMPr+gEoPMPs4='
WHERE
key_id = 'cdc2d409d29dbc4fa0fa9dfe664c19583b75d60988b092745037f64720b2987d'
AND (
token = 'fL9m5oxMGoMHx7D5DsGBfsETLL9ElcVMPr+gEoPMPs4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)