UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oPoPau3Hfb+PQRcgPjfV3wI5ERi0MYkusHudoNdCX+Y='
WHERE
key_id = '20d1fedc3d1c19aa27900d327c40ef30ed5084ed9f4db95ed32f4174ff6beb77'
AND (
token = 'oPoPau3Hfb+PQRcgPjfV3wI5ERi0MYkusHudoNdCX+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)