UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xk5K6LoERfq9xPs1HLMfb4kdBdg4lbK5gmXlCXPRTh4='
WHERE
key_id = '346c9c80168fe80db8a24e4fdfec0d5e842227d3697f6aa35d4d9603e0e1b4e9'
AND (
token = 'xk5K6LoERfq9xPs1HLMfb4kdBdg4lbK5gmXlCXPRTh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)