UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'riOWvcJMFd1Kg6aI5SlZLyTCXdbpr2EWjXFoW+VNLTU='
WHERE
key_id = '2009c05e6463993fa8fdae259f9540505db0b142bc1c50fef41a0307193f2c1f'
AND (
token = 'riOWvcJMFd1Kg6aI5SlZLyTCXdbpr2EWjXFoW+VNLTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)