UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X8W1diJPDWOD3DlII31+qMQQ9RjWvO5Ej1/LVHTwbow='
WHERE
key_id = '3165d8b333fd7048d7321309f110cae9d38d60cda26db5bad1ce95fd4b7bcf07'
AND (
token = 'X8W1diJPDWOD3DlII31+qMQQ9RjWvO5Ej1/LVHTwbow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)