UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nj4IxpRgvuzIoI/24UI3JHitCeZ2KUFdprPSKZxujaY='
WHERE
key_id = 'cf31c017d3d89ed842c8e02222ffd85aa39a3273cebbfe59c3201f8a1e124266'
AND (
token = 'Nj4IxpRgvuzIoI/24UI3JHitCeZ2KUFdprPSKZxujaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)